<?php /* Smarty version Smarty-3.1.18, created on 2016-11-03 15:10:37
         compiled from ".\View\user\index.html" */ ?>
<?php /*%%SmartyHeaderCode:7115581ae997983a95-77671159%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '0258c6ff0e31d7fd7a7f0db0783ebd6cea28f975' => 
    array (
      0 => '.\\View\\user\\index.html',
      1 => 1478165293,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '7115581ae997983a95-77671159',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.18',
  'unifunc' => 'content_581ae9979d5b20_03015469',
  'variables' => 
  array (
    'title' => 0,
    'res' => 0,
    'v' => 0,
    'show' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_581ae9979d5b20_03015469')) {function content_581ae9979d5b20_03015469($_smarty_tpl) {?><!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title><?php echo $_smarty_tpl->tpl_vars['title']->value;?>
</title>
	
	<style type="text/css">
	table{width:500px;height:300px;border-collapse:collapse;margin:30px auto;}
	table td{text-align:center;}
	#show{width:900px;height:30px;margin:5px auto;}
	</style>
	
</head>
<body>
	<table border='1'>
		<tr>
			<td>ID</td>
			<td>用户名</td>
			<td>密码</td>
			<td>年龄</td>
			<td>操作</td>
		</tr>

		<?php  $_smarty_tpl->tpl_vars['v'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['v']->_loop = false;
 $_smarty_tpl->tpl_vars['k'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['res']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['v']->key => $_smarty_tpl->tpl_vars['v']->value) {
$_smarty_tpl->tpl_vars['v']->_loop = true;
 $_smarty_tpl->tpl_vars['k']->value = $_smarty_tpl->tpl_vars['v']->key;
?>
			<tr id='trs'>
				<td><?php echo $_smarty_tpl->tpl_vars['v']->value['id'];?>
</td>
				<td><?php echo $_smarty_tpl->tpl_vars['v']->value['username'];?>
</td>
				<td><?php echo $_smarty_tpl->tpl_vars['v']->value['password'];?>
</td>
				<td><?php echo $_smarty_tpl->tpl_vars['v']->value['age'];?>
</td>
				<td><a href='./index.php?c=User&a=edit&id=<?php echo $_smarty_tpl->tpl_vars['v']->value["id"];?>
'>修改</a>  <a href='./index.php?c=User&a=delete&id=<?php echo $_smarty_tpl->tpl_vars['v']->value["id"];?>
'>删除</a></td>
			</tr>
		<?php } ?>


	</table>
	<div id='show'>
		<?php echo $_smarty_tpl->tpl_vars['show']->value;?>

	</div>

	<script type="text/javascript" src='./Public/js/jquery-1.8.3.min.js'></script>

	<script type="text/javascript">
	
		$('#trs td:nth-child(2)').dblclick(function(){

			var v = $(this).html();
			var input = $('<input type="text" />');
			$(this).empty();
			$(this).append(input);

			input.focus();
			input.val(v);
			input.select();

			var td = $(this);

			input.blur(function(){

				var newV  = $(this).val();

				var id = $(this).parents('tr').find('td').eq(0).html();
				
				$.post('index.php?c=User&a=Update',{username:newV,id:id},function(data){

					if(data == '1'){

						td.html(newV);
					} else {

						td.html(v);
					}
				})
				

			})
		})

	</script>
</body>
</html><?php }} ?>
